package com.ljs.liojbackendjudgeservice.judge.codesandbox;


import com.ljs.liojbackendjudgeservice.judge.codesandbox.imp.ExampleCodeSandbox;
import com.ljs.liojbackendjudgeservice.judge.codesandbox.imp.RemoteCodeSandbox;
import com.ljs.liojbackendjudgeservice.judge.codesandbox.imp.ThirdPartyCodeSandbox;

/**
 * 静态工厂模式创建代码沙箱
 */
public class CodeSandboxFactory {

    public  static  CodeSandbox newInstance(String type){
        switch (type){
            case "example":
                return new ExampleCodeSandbox();
            case "remote":
                return new RemoteCodeSandbox();
            case "thirdParty":
                return new ThirdPartyCodeSandbox();
            default:
                return new ExampleCodeSandbox();
        }
    }
}
